<?php
/**
 * Desc： 控制器
 * Author：Fly
 * DateTime：2020/9/13 9:20
 */

namespace FlyToper\PearBackend;

class PearBackendController
{
    //静态资源路径
    public $static_path = "/static";
    public $view_path = "../src/views";

    //原 pear.config.json 文件
    protected $pear_config = [
        'logo' => [
            'title' => 'Pear Admin',
            'image' => '/static/pear-adminadmin/images/logo.png',
        ],
        'menu' => [
            'data' => '/static/pear-admin/admin/data/menu.json',
            'accordion' => true,
            'control' => false,
            'select' => '0',
        ],
        'tab' => [
            'muiltTab' => true,
            'keepState' => true,
            'tabMax' => 30,
            'index' => [
                'id' => '0',
                'href' => 'javascript:;',
                'title' => '首页',
            ],
        ],
        'theme' => [
            'defaultColor' => '3',
            'defaultMenu' => 'light-theme',
            'allowCustom' => true,
        ],
        'colors' => [
            [
                'id' => '1',
                'color' => '#FF5722',
            ],
            [
                'id' => '2',
                'color' => '#5FB878',
            ],
            [
                'id' => '3',
                'color' => '#1E9FFF',
            ],
            [
                'id' => '4',
                'color' => '#FFB800',
            ],
            [
                'id' => '5',
                'color' => 'darkgray',
            ],
        ],
        'links' => [
            [
                'icon' => 'layui-icon layui-icon-website',
                'title' => '官方网站',
                'href' => 'http://www.pearadmin.com',
            ],
            [
                'icon' => 'layui-icon layui-icon-read',
                'title' => '开发文档',
                'href' => 'http://www.pearadmin.com/doc/',
            ],
            [
                'icon' => 'layui-icon layui-icon-fonts-code',
                'title' => '开源地址',
                'href' => 'https://gitee.com/Jmysy/Pear-Admin-Layui',
            ],
            [
                'icon' => 'layui-icon layui-icon-survey',
                'title' => '问答社区',
                'href' => 'http://forum.pearadmin.com/',
            ],
        ],
        'other' => [
            'keepLoad' => 1200,
        ],
    ];

    public function index()
    {
        $html = file_get_contents( '../src/views/index.html');

        return str_replace('__STATIC__', $this->static_path, $html);
    }

    public function menu()
    {
        return [];
    }

    public function pearConfig()
    {
        return $this->pear_config;
    }

    public function demo()
    {
        $html = file_get_contents( '../src/views/main.html');

        $h1 = '111111111111111111';

        echo str_replace('__STATIC__', $this->static_path, $html);
    }



}